<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="批次号" prop="pch">
        <el-input
          v-model="queryParams.pch"
          placeholder="请输入批次号"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-table  :data="pcglList" >
      <el-table-column label="批次号" align="center" prop="pch" />
      <el-table-column label="区域名称" align="center" prop="qymc" />
      <el-table-column label="种植面积" align="center" prop="zzmj" />
      <el-table-column label="创建时间" align="center" prop="createtime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createtime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
    </el-table>
    <el-table  :data="nsjhglList" >
      <el-table-column label="农事类型" align="center" prop="nslx" />
      <el-table-column label="计划时间" align="center" prop="jhsj" />
      <el-table-column label="农资类型" align="center" prop="nzlx" />
      <el-table-column label="图片地址" align="center" prop="path" />
      <el-table-column label="文字描述" align="center" prop="wzms" />
    </el-table>


  </div>
</template>

<script>
import { listNsjhgl, getNsjhgl, delNsjhgl, addNsjhgl, updateNsjhgl } from "@/api/work/nsjhgl";
import { listPcgl, getPcgl, delPcgl, addPcgl, updatePcgl } from "@/api/work/pcgl";

export default {
  name: "Symcx",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 农事计划管理表格数据
      nsjhglList: [],
      pcglList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pch: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    // this.getList();
  },
  methods: {
    /** 查询农事计划管理列表 */
    getListNs() {
      this.loading = true;
      listNsjhgl(this.queryParams).then(response => {
        this.nsjhglList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 查询批次管理列表 */
    getListPc() {
      this.loading = true;
      listPcgl(this.queryParams).then(response => {
        this.pcglList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        nslx: null,
        jhsj: null,
        nzlx: null,
        path: null,
        wzms: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.getListPc();
      this.getListNs();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },

  }
};
</script>
